<?php
//示例
use think\facade\Route;

Route::group('api', function () {// api 版本
    Route::group(function () {  //需要登录
        //单聊
        Route::post('send_message', 'api.message/send');
        //创建房间
        Route::post('group_add', 'api.group/add');
        //房间消息
        Route::post('send_group_message', 'api.message/send_group');
        //上传图片
        Route::post('upload_img', 'api.upload/image');
        //换取新token
        Route::post('new_token', 'api.user/new_token');

    })->middleware(\app\middleware\Auth::class);

    Route::group(function () {  //不需要登录
        Route::post('login', 'api.user/login');
        Route::get('cs', 'api/cs');
    });
})->allowCrossDomain();

Route::miss(function () { //强制路由不存在
    \Api::error('api', 405);
});
